import request from '@/config/axios'
import { baseUrl } from '@/config/env';


export function getRoleIdsByUserId(userId){
  return request({
    url:baseUrl+'/sys/role/user/'+userId,
    method:'get',
  })
}

export function permissionUpdate(roleId, menuIds) {
  return request({
    url: baseUrl+'/sys/role/menu',
    method: 'put',
    data: {
      roleId: roleId,
      menuIds: menuIds
    }
  })
}


export function fetchList(query) {
  return request({
    url: baseUrl+'/sys/role/page',
    method: 'get',
    params: query
  })
}

export function getObj(id) {
  return request({
    url: baseUrl+'/sys/role/' + id,
    method: 'get'
  })
}


export function addObj(obj) {
  return request({
    url: baseUrl+'/sys/role',
    method: 'post',
    data: obj
  })
}

export function putObj(obj) {
  return request({
    url: baseUrl+'/sys/role',
    method: 'put',
    data: obj
  })
}

export function delObj(row) {
  return request({
    url: baseUrl+'/sys/role/' + row.id,
    method: 'delete'
  })
}

